<template>
  <div id="cornerComment" v-if="dialogVisible">
    <div class="cornerComment-in">
      <div class="cornerComment-in-title">
        <span>【{{ cornerData.name }}】【{{ sectionData.section_name }}】【{{levelData.name}}】明细</span>
        <span class="el-icon-circle-close close-Btn-line" @click="closePOpup"></span>
      </div>
      <div class="commentBody">
        <el-table
            ref="multipleTable"
            :data="arryList"
            :stripe="tableoption.tableStripe"
            :border="tableoption.tableBorder"
            tooltip-effect="dark"
            style="width: 100%"
            size="mini"
            height="400px"
            header-cell-class-name="table-text-c"
            cell-class-name="table-text-c">
          <el-table-column
              prop="id"
              label="ID"
              width="50"
          align="center">
          </el-table-column>
          <el-table-column
              label="头像"
              align="center"
              width="100">
            <template slot-scope="scope">
              <ImagePreview :src="scope.row.pic" width="40px" height="40px"></ImagePreview>
            </template>
          </el-table-column>
          <el-table-column
              prop="name"
              align="center"
              label="学生姓名">
          </el-table-column>
          <el-table-column
              align="center"
              label="班级">
            <template slot-scope="scope">
              {{scope.row.classes.class_name}}
            </template>
          </el-table-column>
        </el-table>
<!--        <el-col :span="24" class="toolbar">-->
<!--          <el-pagination-->
<!--              background-->
<!--              :page-size="page.pagesize"-->
<!--              :current-page="page.pageindex"-->
<!--              layout="total, prev, pager, next"-->
<!--              :total="page.total"-->
<!--              @current-change="handleSizeChange"></el-pagination>-->
<!--        </el-col>-->
      </div>
      <div class="cornerComment-in-footer">
        <el-button @click.native="closePOpup" size="small">确定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import {cornerBrandStudent} from "@/api/admin/corner"
import {pagination, tableoption} from '@/utils/util.js';

export default {
  props: ['visible', 'sectionData', 'cornerData', 'levelData'], // recruitmentType examine 审核
  components: {},
  data() {
    return {
      dialogVisible: false,
      arryList: [],
      tableoption: tableoption,
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
    }
  },
  watch: {
    visible() {
      this.dialogVisible = this.visible
      if (this.visible) {
        this.InitFn()
      } else {
        this.arryList = []
      }
    }
  },
  created() {

  },
  methods: {
    // 初始化
    InitFn() {
      cornerBrandStudent({id: this.levelData.logId}).then(res => {
        console.log('res:', res)
        this.arryList = res.list
      })
    },
    handleSizeChange(val) {
      this.page.pageindex = val
      this.InitFn()
    },
    // 关闭弹窗
    closePOpup() {
      this.$emit('update:visible', false)
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
  },
  mounted() {
  }
}
</script>
<style scoped>
#cornerComment {
  height: 100vh;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9;
}

.cornerComment-in {
  width: 500px;
 height: 520px;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
}

.cornerComment-in-title {
  height: 50px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #ddd;
  font-size: 24px;
}

.cornerComment-in-title span {
  padding: 0 10px;
}

.cornerComment-in-title span:first-child {
  flex: 1;
  font-size: 16px;
}

.cornerComment-in-footer {
  height: 50px;
  border-top: 1px solid #ddd;
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;
}

.commentBody {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
}

.close-Btn-line {
  cursor: pointer;
}

</style>

